<?php
/**
 * 后台预加载活动奖励
 *
 * created by.
 * User: EDZ
 * Date: 2020/9/26
 * TIME: 15:07
 */

namespace app\admin_product_libaray\admin_ready_module\model;

use think\Model;

class ActivityModel extends Model{

    public $name = 'activity';

    /**
     * 获取加载活动默认数据
     *
     * @var array
     */
    private $data = [
      'count'   =>  0,
      'activity'    =>  []
    ];

    /**
     * 获取用户预加载活动
     *
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     *
     * @author liuyifan
     * @date 2020/9/26 15:13
     */
    public static function getNewActivity(){
       $data = self::where(['uid' => session('uid')])->selectOrFail();
       return [
           'count'  =>  count($data),
           'data'   =>  $data
       ];
    }
}